Skip to content

Configure infisical API URL in .infisical.json#242

Open
gee-forr wants to merge 6 commits into
Infisical:mainfrom
gee-forr:main
Open

Configure infisical API URL in .infisical.json#242
gee-forr wants to merge 6 commits into
Infisical:mainfrom
gee-forr:main

Conversation

@gee-forr
Copy link
Copy Markdown

Description 📣

This PR resolves #206

I've always found it strange that I have to configure part of a project's infisical setup in .infiscal.json, and then another part with the $INFISICAL_API_URL environment variable. It makes complete sense that this static piece of data could live in the .infisical.json file and not feel out of place.

I've updated the CLI so that if apiUrl is defined in the .infiscal.json file, it's used, like so:

{
  "workspaceId":                   "ea1b0a5f-xxxx-xxxx-xxxx-a1ef1c323cc1",
  "defaultEnvironment":            "dev",
  "gitBranchToEnvironmentMapping": null,
  "apiUrl":                        "https://my.infisical.instance.com/api"
}

I've also ensured that precedence is preserved and makes sense. Precedence for specifying this value is as follows:

--domain flag → $INFISICAL_API_URL env var → .infisical.json → default value

NOTE If this PR is accepted and merged in, I'll issue another PR to update the CLI docs here to include documentation for these changes.

Type ✨

  • Bug fix
  • New feature
  • Improvement
  • Breaking change
  • Documentation

Tests 🛠️

I've added tests to packages/util/config_test.go. Please let me know if this is the correct location for tests? There seem to be tests in a few different places.

 go test ./packages/util/ -run TestGetWorkspaceConfigByPath -v
=== RUN   TestGetWorkspaceConfigByPath_WithApiUrl
--- PASS: TestGetWorkspaceConfigByPath_WithApiUrl (0.00s)
=== RUN   TestGetWorkspaceConfigByPath_WithoutApiUrl
--- PASS: TestGetWorkspaceConfigByPath_WithoutApiUrl (0.00s)
=== RUN   TestGetWorkspaceConfigByPath_WithMalformedApiUrl
--- PASS: TestGetWorkspaceConfigByPath_WithMalformedApiUrl (0.00s)
PASS
ok  	github.com/Infisical/infisical-merge/packages/util	(cached)

(disclosure: I was assisted by AI when authoring this contribution, as go is not a language I am fully proficient in)

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@gee-forr
Copy link
Copy Markdown
Author

@saifsmailbox98 - apologies on @'ing you out of the blue.

Please could you request a review from the Claude Bot? I'd like to address any changes it might raise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Read infisical API URL from infisical.json

1 participant